<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>TodoList</title>
    <style>
        .empty{
            border-color: red;
        }
    </style>
</head>
<body>
<div id="app">
    <input type="text" v-model="girl"  v-bind:class="{empty:!count}" >
    <button @click="mygirl">Enjoy</button>
  Your lover:  {{girl}},her length:{{count}}

</div>
<script src="../js/vue.js"></script>
<script>
    var app=new Vue({
        el: '#app',
        data:{
            girl:'苏小小'
        },
        methods:{

                mygirl:function () {
                    if(this.count==0){
                        alert("Pleas Input your want girl！")
                    }else
                       alert("Enjoy this time,your girl: "+this.girl)
                    this.girl=''
                }

        },
        computed:{
            count:function () {
                return this.girl.length;
            }
        }
    })
</script>
</body>
</html>